package ooday01;

public class Student {
    String name;
    int age;
    String className;
    String stuId;

    //构造方法
    Student() {
    }

    Student(String name, int age, String className, String stuId) {
        this.name = name;                 //想要用成员变量要加this，不然就是按照就近原则来
        this.age = age;
        this.className = className;
        this.stuId = stuId;
    }


    void study() {            //zg。name    默认参数为this
        System.out.println(this.name + "在学习");
    }

    void sayhi() {                      //zg.name          zg.age                    zg.className            zg.stuId
        System.out.println("大家好，我叫" + this.name + "，今年" + this.age + "岁了，所在班级为" + this.className + "学号为：" + this.stuId);
    }

    void playWith(String anotherName) {
        //                    zg.name
        System.out.println(this.name + "正在和" + anotherName + "一起玩");
    }
    //student    stu    =     newStudent
    // 数据类型    引用   指向     对象


}
